"""
-*- coding:utf-8 -*-
__project__ = "python_study_one"
__file_name__ = "study2020_11_06"
__author__ = "admin"
__time__ = "2020/11/6 22:45"
__product_name__ = PyCharm 
"""
"""
# 剪刀石头布五局三胜，平局则继续，退出循环
import random
print("=====================================")
count_sum = 0  # 总局数
count_player = 0  # 玩家赢次数
count_computer = 0  # 电脑赢次数
count = 0  # 平局次数
while count_player < 3 or count_computer <3:
    print("这是第 %d 局，玩家赢了 %d 次，电脑赢了 %d 次，平局了 %d 次\n" % (count_sum, count_player, count_computer, count))
    print("猜拳游戏:剪刀，石头，布")  # 剪刀（0），石头（1），布（2）
    player = input("请输入：\n")
    compute_list = ["剪刀", "石头", "布"]
    compute_win = [["剪刀","石头"],["石头","布"],["布","剪刀"]]
    computer = random.choice(compute_list)
    if player not in compute_list:
        print("请重新输入")
        continue
    count_sum += 1
    print("玩家出的 %s ，电脑出的 %s ," % (player, computer))
    if [player,computer] in compute_win:
        print("电脑赢了！！！")
        count_computer += 1
        print("电脑赢了%d 次！！！\n" % count_computer)
        if count_computer == 3:
            print("游戏结束")
            break
    elif player == computer:
        print("平局")
        count += 1
        print("平局了 %d 次\n" % count)
    else:
        print(" 玩家赢了！！！")
        count_player += 1
        print(" 玩家赢了%d 次！！！\n" % count_player)
        if count_player == 3:
            print("游戏结束")
            break
            

一个学校，三个办公室，八位老师，随机分配办公室
import random
school = [[],[],[]]
teacher = ["t1","t2","t3","t4","t5","t6","t7","t8"]
for t in teacher:
    school_office = random.randint(0,2)
    school[school_office].append(t)
print(school)
"""
"""
# 1.python基础
# 
# 1.1 str = "a,hello"在字符串str中查到hello；
str = "a,hello"
# 方法一 返回字符串所在位置的下标
print(str.find("hello"))
print(str.index("hello"))
# 方法二 返回条件语句
if "hello" in str:
    print("hello存在字符串中")
else:
    print("不存在")

# 1.2 str = "a,b,c,d"用逗号分割str字符串，并保存在列表中；
str = "a,b,c,d"
print(str.split(","))
# 1.3 将"笔试题 123A"中 123 替换为"进行中"；
str = "笔试题 123A"
print(str.replace("123","进行中"))
"""
